Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage optimization #274

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Storage optimization #274

merged 1 commit into from
Oct 29, 2024

Conversation

Saloed
Copy link
Collaborator

@Saloed Saloed commented Oct 29, 2024

[jacodb-core] Add de-duplication of attribute values in AttributesImmutable

As of this commit, values array contains only different attribute values.

[jacodb-core] Close ers iff it was initialized

[jacodb-core] Processed only jar files referenced in the Class-Path attribute of manifest

[jacodb-storage] Fix minor memory usage issue in AttributesImmutable

Avoid using class constructor parameters in lazy fields.

[jacodb-storage] Reduce memory usage by InstanceIdCollections

In this commit, two implementation of InstanceIdCollection added, SortedIntArrayInstanceIdCollection & UnsortedIntArrayInstanceIdCollection. If instances ids of particular attributes cannot be packed in a LongRange, but if they all can be represented as an Int, then corresponding implementations wrap IntArray, not LongArray.

[jacodb-storage] Minor: toAttributesImmutable() is an extension for list of attribute pairs

[jacodb-storage] Optimize AttributesImmutable.navigate() in case of sorted by value attributes

If attributes are sorted by value, in binary search algorithm, getting instance id by index of an attribute value can be skipped. In that case, copying of the attribute value in an extra byte array is redundant, and comparing can be done by a special comparison function.

[jacodb-storage] Re-order built-in bindings

[jacodb-storage] Optimize dealing with instance ids in AttributesImmutable

Instead of LongArray, instance ids are represented by implementors of InstanceIdCollection. LongRangeInstanceIdCollection saves memory by using LongRange instead of LongArray. The getByIndex() method introduced and used where possible in order to skip conversion of instance id to index in InstanceIdCollection to load values from values byte array.

[jacodb-benchmarks] Make RAMEntityRelationshipStorageBenchmarks more correct

Fewer operations on each invocation, this reduces Java GC load.

[jacodb-storage] Optimize PropertiesMutable.getEntitiesLtValue() & PropertiesMutable.getEntitiesEqOrLtValue()

Minor optimization: exit iteration over value index earlier. This is okay since all further values are greater than specified one.

[jacodb-benchmarks] Add benchmarks of RAM implementation of ERS API

[jacodb-storage] Get rid of using one-nio library

ByteArrayBuilder added instead of one-nio's one.
SparseBitSet moved to the 'org.jacodb.util.collections' package.

[jacodb-core] Add de-duplication of attribute values in AttributesImmutable

As of this commit, values array contains only different attribute values.

[jacodb-core] Close ers iff it was initialized

[jacodb-core] Processed only jar files referenced in the Class-Path attribute of manifest

[jacodb-storage] Fix minor memory usage issue in AttributesImmutable

Avoid using class constructor parameters in lazy fields.

[jacodb-storage] Reduce memory usage by InstanceIdCollections

In this commit, two implementation of InstanceIdCollection added,
SortedIntArrayInstanceIdCollection & UnsortedIntArrayInstanceIdCollection.
If instances ids of particular attributes cannot be packed in a LongRange,
but if they all can be represented as an Int, then corresponding
implementations wrap IntArray, not LongArray.

[jacodb-storage] Minor: toAttributesImmutable() is an extension for list of attribute pairs

[jacodb-storage] Optimize AttributesImmutable.navigate() in case of sorted by value attributes

If attributes are sorted by value, in binary search algorithm, getting instance id
by index of an attribute value can be skipped. In that case, copying of the attribute
value in an extra byte array is redundant, and comparing can be done by a special
comparison function.

[jacodb-storage] Re-order built-in bindings

[jacodb-storage] Optimize dealing with instance ids in AttributesImmutable

Instead of LongArray, instance ids are represented by implementors of InstanceIdCollection.
LongRangeInstanceIdCollection saves memory by using LongRange instead of LongArray.
The getByIndex() method introduced and used where possible in order to skip
conversion of instance id to index in InstanceIdCollection to load values from
values byte array.

[jacodb-benchmarks] Make RAMEntityRelationshipStorageBenchmarks more correct

Fewer operations on each invocation, this reduces Java GC load.

[jacodb-storage] Optimize PropertiesMutable.getEntitiesLtValue() & PropertiesMutable.getEntitiesEqOrLtValue()

Minor optimization: exit iteration over value index earlier.
This is okay since all further values are greater than specified one.

[jacodb-benchmarks] Add benchmarks of RAM implementation of ERS API

[jacodb-storage] Get rid of using one-nio library

ByteArrayBuilder added instead of one-nio's one.
SparseBitSet moved to the 'org.jacodb.util.collections' package.
Copy link
Contributor

Lifecycle test results

78 tests  ±0   78 ✅ ±0   1m 41s ⏱️ -12s
 7 suites ±0    0 💤 ±0 
 7 files   ±0    0 ❌ ±0 

Results for commit c53fa38. ± Comparison against base commit e86abeb.

Copy link
Contributor

Test results on JDK 19

   88 files  ±0     88 suites  ±0   13m 10s ⏱️ -50s
2 529 tests ±0  2 488 ✅ ±0  41 💤 ±0  0 ❌ ±0 
2 557 runs  ±0  2 516 ✅ ±0  41 💤 ±0  0 ❌ ±0 

Results for commit c53fa38. ± Comparison against base commit e86abeb.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 61.53846% with 45 lines in your changes missing coverage. Please review.

Project coverage is 59.22%. Comparing base (e86abeb) to head (c53fa38).
Report is 1 commits behind head on neo.

Files with missing lines Patch % Lines
...jacodb/impl/storage/ers/ram/AttributesImmutable.kt 59.09% 26 Missing and 10 partials ⚠️
...n/org/jacodb/impl/storage/SQLitePersistenceImpl.kt 0.00% 4 Missing and 1 partial ⚠️
...rc/main/kotlin/org/jacodb/util/ByteArrayBuilder.kt 75.00% 1 Missing and 2 partials ⚠️
...ain/kotlin/org/jacodb/impl/fs/ByteCodeLocations.kt 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                neo     #274      +/-   ##
============================================
- Coverage     59.29%   59.22%   -0.07%     
- Complexity     2601     2608       +7     
============================================
  Files           319      320       +1     
  Lines         19067    19144      +77     
  Branches       2823     2845      +22     
============================================
+ Hits          11305    11338      +33     
- Misses         6676     6710      +34     
- Partials       1086     1096      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Test results on JDK 11

   88 files  ±0     88 suites  ±0   17m 4s ⏱️ -46s
2 529 tests ±0  2 490 ✅ ±0  39 💤 ±0  0 ❌ ±0 
2 557 runs  ±0  2 518 ✅ ±0  39 💤 ±0  0 ❌ ±0 

Results for commit c53fa38. ± Comparison against base commit e86abeb.

Copy link
Contributor

Test results on JDK 8

   88 files  ±0     88 suites  ±0   17m 41s ⏱️ +10s
2 529 tests ±0  2 485 ✅ ±0  44 💤 ±0  0 ❌ ±0 
2 557 runs  ±0  2 513 ✅ ±0  44 💤 ±0  0 ❌ ±0 

Results for commit c53fa38. ± Comparison against base commit e86abeb.

@Saloed Saloed merged commit 335977f into neo Oct 29, 2024
11 checks passed
@Saloed Saloed deleted the saloed/storage-optimization branch October 29, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant